ostree.git
10 years agotests: Link test-gpg-verify-result with gpgme
Dan Nicholson [Tue, 12 May 2015 22:48:22 +0000 (15:48 -0700)]
tests: Link test-gpg-verify-result with gpgme

This test uses gpgme directly to verify the signatures, so it needs to
find the gpgme headers and link with gpgme to ensure the linker can
resolve the symbols.

10 years agoFix tests on 32 bit systems
John Hiesey [Wed, 6 May 2015 23:41:55 +0000 (16:41 -0700)]
Fix tests on 32 bit systems

Use guint64 when the 't' format is used for GVariant

10 years agogpg: Gracefully handle no trusted.gpg.d directory
Matthew Barnes [Thu, 28 May 2015 20:25:51 +0000 (16:25 -0400)]
gpg: Gracefully handle no trusted.gpg.d directory

This is a deprecated fallback method anyway.  We prefer
remote-specific keyrings now.

https://bugzilla.gnome.org/750049

10 years agoRelease 2015.7
Colin Walters [Tue, 2 Jun 2015 16:59:48 +0000 (12:59 -0400)]
Release 2015.7

10 years agotests/remote-gpg-import: Only commit workdir
Colin Walters [Tue, 2 Jun 2015 16:38:26 +0000 (12:38 -0400)]
tests/remote-gpg-import: Only commit workdir

Just noticed this while debugging something else.  We don't want to
commit the whole test dir, just the workdir.

Trying to commit the repo itself is potentially subject to race
conditions at least.

10 years agotests: Run all tests through a randomized readdir()
Colin Walters [Tue, 2 Jun 2015 02:34:14 +0000 (22:34 -0400)]
tests: Run all tests through a randomized readdir()

Having undefined (but in practice rarely changing) ordering for
`readdir()` ended up screwing us over for bootloader config
generation; see https://bugzilla.redhat.com/show_bug.cgi?id=1226520

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.

10 years agoRevert "tests: Run all tests through a randomized readdir()"
Colin Walters [Tue, 2 Jun 2015 16:02:24 +0000 (12:02 -0400)]
Revert "tests: Run all tests through a randomized readdir()"

Unintentionally pushed.

This reverts commit ce49264157f9005e664557613cbbf67f54174682.

10 years agotests: Add a test-pull-summary-sigs
Colin Walters [Mon, 1 Jun 2015 22:40:44 +0000 (18:40 -0400)]
tests: Add a test-pull-summary-sigs

This is intended to cover non-mirroring usage of GPG + summary +
deltas.

10 years agorepo: Don't crash when creating a summary if we have --empty deltas
Colin Walters [Mon, 1 Jun 2015 22:40:04 +0000 (18:40 -0400)]
repo: Don't crash when creating a summary if we have --empty deltas

10 years agotests: Add a commented out test for mirroring with deltas
Colin Walters [Mon, 1 Jun 2015 22:15:42 +0000 (18:15 -0400)]
tests: Add a commented out test for mirroring with deltas

10 years agopull: Validate delta checksums more strongly
Colin Walters [Mon, 1 Jun 2015 20:56:19 +0000 (16:56 -0400)]
pull: Validate delta checksums more strongly

We need to check that it's 'ay'.  Also reuse the existing validation
function to check it's 32 bytes rather than potentially crashing with
assertion.

Just noticed this during a code review.

10 years agopull: Ensure console state for multiple GPG verification messages
Colin Walters [Mon, 1 Jun 2015 21:39:39 +0000 (17:39 -0400)]
pull: Ensure console state for multiple GPG verification messages

If there are multiple signatures to verify, we would attempt to
display them multiple times, but we can only call
`gs_console_end_status_line()` if the console has been enabled.

Ensure we turn back on the console after printing our status.  This
will result in extra newlines, but fixing that cleanly would require a
saner GSConsole API.

10 years agotests: Run all tests through a randomized readdir()
Colin Walters [Tue, 2 Jun 2015 02:34:14 +0000 (22:34 -0400)]
tests: Run all tests through a randomized readdir()

Having undefined ordering (but in practice rarely changing)
ordering for `readdir()` ended up screwing us over with respect
to bootloader config file read ordering.

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.

10 years agotests: Add a crosscheck for syslinux bootloader config generation
Colin Walters [Thu, 28 May 2015 00:08:44 +0000 (20:08 -0400)]
tests: Add a crosscheck for syslinux bootloader config generation

And actually wire this one up in admin-test.sh.

10 years agotests: Add a test script to cross-check loader config vs GRUB2
Colin Walters [Wed, 27 May 2015 02:28:29 +0000 (22:28 -0400)]
tests: Add a test script to cross-check loader config vs GRUB2

One can run this on a machine to validate things.  I'd like to
get this plugged into the actual OSTree tests as soon as we can
figure out how to sanely run grub2-generate as non-root in
our test suite.

Alternatively, this script can easily be run on a real install.

10 years agosysroot: Sort returned boot loader configs
Colin Walters [Tue, 26 May 2015 22:46:47 +0000 (18:46 -0400)]
sysroot: Sort returned boot loader configs

I haven't done a full dig through the history, but it seems quite
possible right now we've been relying on inode enumeration
order for generating bootloader configuration.

Most of the time, newer inodes (i.e. later written files) will win.
But that's obviously not reliable.

Fix this by sorting the returned configuration internally.

10 years agoFix annotations on ostree_repo_remote_gpg_import().
Jeff Ortel [Tue, 26 May 2015 16:17:28 +0000 (11:17 -0500)]
Fix annotations on ostree_repo_remote_gpg_import().

10 years agoostree-repo: document OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES
Giuseppe Scrivano [Tue, 19 May 2015 09:12:14 +0000 (11:12 +0200)]
ostree-repo: document OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoadmin: Ensure instutil commands and usage help don't grab lock
Colin Walters [Fri, 15 May 2015 12:51:47 +0000 (08:51 -0400)]
admin: Ensure instutil commands and usage help don't grab lock

When I was introducing the `_UNLOCKED` flag, I only audited
subcommands of `ostree admin`, but I missed that `ostree admin
instutil` also used the option parsing.  Those are only used by
Anaconda today so we can ignore them for locking purposes.

Also, the usage help generation was grabbing the lock unnecessarily.

10 years agorepo: Prevent GPG keys from being imported to keybox format
Matthew Barnes [Thu, 14 May 2015 16:44:36 +0000 (12:44 -0400)]
repo: Prevent GPG keys from being imported to keybox format

If a remote keyring does not already exist, create an empty pubring.gpg
file in the temporary directory prior to importing keys.  This prevents
gpg2 from creating a pubring.kbx file in the new keybox format [1].  We
want to stay with the older keyring format since its performances issues
are not relevant here.

[1] https://gnupg.org/faq/whats-new-in-2.1.html#keybox

10 years agorepo: Bump mtime any time we write a ref
Colin Walters [Thu, 14 May 2015 01:59:17 +0000 (21:59 -0400)]
repo: Bump mtime any time we write a ref

External daemons like rpm-ostree want push notification any time a
change is made by an external entity.  inotify provides notification,
but a problem is there's no easy way to monitor all of the refs.

In the past, there has been discussion of opt-in recursive timestamps:
https://lkml.org/lkml/2013/4/5/307

But in today's world, let's just bump the mtime on the repo itself, as
a central inotify point.

Closes: https://github.com/GNOME/ostree/pull/111
10 years agoostree-repo: replace more gs_unref_(variant|bytes) with g_autoptr
Giuseppe Scrivano [Thu, 14 May 2015 07:56:00 +0000 (09:56 +0200)]
ostree-repo: replace more gs_unref_(variant|bytes) with g_autoptr

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotest-basic: Always chown back before doing assertion
Colin Walters [Thu, 14 May 2015 02:17:26 +0000 (22:17 -0400)]
test-basic: Always chown back before doing assertion

Sometimes I rerun the tests for debugging in the same directory, and
having it be not writable breaks `rm * -rf`.

10 years agotests: Fix writable repo test
Colin Walters [Thu, 14 May 2015 02:11:39 +0000 (22:11 -0400)]
tests: Fix writable repo test

When I removed the `transaction` symlink, that made this test start
failing.  Fix it by doing `chmod` on `repo/objects`, which is what the
core `ostree_repo_is_writable()` looks at.

10 years agoadmin: Use locking for most sysroot commands
Colin Walters [Wed, 13 May 2015 20:48:09 +0000 (16:48 -0400)]
admin: Use locking for most sysroot commands

The previous commit introduced locking for `ostree admin deploy`, but
we do expect people to possibly accidentally do e.g.
`ostree admin upgrade` concurrently.

Using consistent locking in the admin commands will help rpm-ostree.

Closes: https://github.com/GNOME/ostree/pull/110
10 years agotests: Add test-remote-gpg-import.sh
Matthew Barnes [Thu, 7 May 2015 17:42:19 +0000 (13:42 -0400)]
tests: Add test-remote-gpg-import.sh

10 years agoostree: Add --gpg-import to the "remote add" command
Matthew Barnes [Sat, 9 May 2015 13:50:24 +0000 (09:50 -0400)]
ostree: Add --gpg-import to the "remote add" command

Convenience option imports GPG keys for a newly-created remote.

10 years agoostree: Add a "remote gpg-import" command
Matthew Barnes [Fri, 1 May 2015 13:09:42 +0000 (09:09 -0400)]
ostree: Add a "remote gpg-import" command

Imports GPG keys into a remote-specific keyring.

10 years agorepo: Add remote's keyring during GPG verification
Matthew Barnes [Fri, 1 May 2015 19:38:08 +0000 (15:38 -0400)]
repo: Add remote's keyring during GPG verification

This is pretty fugly but it at least avoids new public API.

10 years agorepo: Add ostree_repo_remote_gpg_import()
Matthew Barnes [Tue, 28 Apr 2015 17:26:00 +0000 (13:26 -0400)]
repo: Add ostree_repo_remote_gpg_import()

Imports one or more GPG keys from a source stream or from the user's
personal keyring into a remote-specific keyring.  The keys to import
can optionally be restricted by a list of key IDs.

The imported keys are used to conduct GPG verification when pulling
from the given remote.

10 years agorepo: Delete a remote's keyring when deleting a remote
Matthew Barnes [Fri, 1 May 2015 14:06:24 +0000 (10:06 -0400)]
repo: Delete a remote's keyring when deleting a remote

10 years agorepo: Stash keyring name in OstreeRemote
Matthew Barnes [Tue, 28 Apr 2015 17:32:32 +0000 (13:32 -0400)]
repo: Stash keyring name in OstreeRemote

10 years agomaint.mk: Remove GNU releases specific bits
Giuseppe Scrivano [Tue, 12 May 2015 07:48:43 +0000 (09:48 +0200)]
maint.mk: Remove GNU releases specific bits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosyntax-check: add syntactic rule to prohibit gs_strfreev
Giuseppe Scrivano [Tue, 12 May 2015 07:41:44 +0000 (09:41 +0200)]
syntax-check: add syntactic rule to prohibit gs_strfreev

and fix an instance.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosyntax-check: add syntactic rule to prohibit gs_unref_*
Giuseppe Scrivano [Tue, 12 May 2015 07:39:13 +0000 (09:39 +0200)]
syntax-check: add syntactic rule to prohibit gs_unref_*

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add new test for pull --disable-static-deltas
Giuseppe Scrivano [Tue, 12 May 2015 08:57:03 +0000 (10:57 +0200)]
tests: add new test for pull --disable-static-deltas

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agodoc: add missing options block for pull
Giuseppe Scrivano [Tue, 12 May 2015 08:39:37 +0000 (10:39 +0200)]
doc: add missing options block for pull

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: add new switch option --disable-static-deltas
Giuseppe Scrivano [Tue, 12 May 2015 08:15:30 +0000 (10:15 +0200)]
pull: add new switch option --disable-static-deltas

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree-repo-pull: add option to disable static-deltas
Giuseppe Scrivano [Tue, 12 May 2015 08:06:56 +0000 (10:06 +0200)]
ostree-repo-pull: add option to disable static-deltas

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosysroot: Add a try_lock() API
Colin Walters [Thu, 7 May 2015 02:19:05 +0000 (22:19 -0400)]
sysroot: Add a try_lock() API

The blocking locking API wasn't sufficient for use in the rpm-ostree
daemon; it really wants to know if the lock is held, then continue to
do other things (like service DBus requests), and get notification
when the lock is available.

We also add an async variant that can be called if the lock is not
available.

Implement a higher level "loop until lock is available" method in the
`ostree admin` commandline.

10 years agorepo: Simplify sign_data() a little
Matthew Barnes [Thu, 7 May 2015 21:50:22 +0000 (17:50 -0400)]
repo: Simplify sign_data() a little

Use ot_gpgme_data_output() to wrapper a GOutputStream.

10 years agogpg: Add custom data buffers to wrapper GIO streams
Matthew Barnes [Thu, 7 May 2015 21:02:37 +0000 (17:02 -0400)]
gpg: Add custom data buffers to wrapper GIO streams

ot_gpgme_data_input() and ot_gpgme_data_output(), shamelessly ripped
off from seahorse_gpgme_data_input() and seahorse_gpgme_data_output().

10 years agogpg: Fix ot_gpgme_error_to_gio_error()
Matthew Barnes [Thu, 7 May 2015 20:02:39 +0000 (16:02 -0400)]
gpg: Fix ot_gpgme_error_to_gio_error()

Need to extract the error code from a gpgme_error_t, can't just compare
it directly.

10 years agoot-fs-utils: remove empty line at EOF
Giuseppe Scrivano [Thu, 7 May 2015 19:59:30 +0000 (21:59 +0200)]
ot-fs-utils: remove empty line at EOF

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosummary: delete summary.sig on an update
Giuseppe Scrivano [Mon, 4 May 2015 09:05:23 +0000 (11:05 +0200)]
summary: delete summary.sig on an update

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add a test for signed summary file
Giuseppe Scrivano [Thu, 30 Apr 2015 07:36:27 +0000 (09:36 +0200)]
tests: add a test for signed summary file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: verify signature for the summary file
Giuseppe Scrivano [Wed, 29 Apr 2015 13:24:28 +0000 (15:24 +0200)]
pull: verify signature for the summary file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosummary: add new command line arguments to sign the summary file
Giuseppe Scrivano [Wed, 29 Apr 2015 09:43:17 +0000 (11:43 +0200)]
summary: add new command line arguments to sign the summary file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree-repo: add new API to sign the summary file
Giuseppe Scrivano [Sun, 3 May 2015 20:40:27 +0000 (22:40 +0200)]
ostree-repo: add new API to sign the summary file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: get rid of detached metadata for deltas
Giuseppe Scrivano [Tue, 28 Apr 2015 16:47:21 +0000 (18:47 +0200)]
pull: get rid of detached metadata for deltas

Once the summary file will be signed, we can validate the superblock
from there.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: check that the superblock checksum is the same as in the summary
Giuseppe Scrivano [Tue, 28 Apr 2015 16:45:11 +0000 (18:45 +0200)]
pull: check that the superblock checksum is the same as in the summary

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocore: store information about delta files checksums
Giuseppe Scrivano [Tue, 28 Apr 2015 15:46:18 +0000 (17:46 +0200)]
core: store information about delta files checksums

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocore: new function _ostree_parse_delta_name
Giuseppe Scrivano [Tue, 28 Apr 2015 15:45:37 +0000 (17:45 +0200)]
core: new function _ostree_parse_delta_name

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosummary: list the available static deltas
Giuseppe Scrivano [Mon, 27 Apr 2015 18:31:05 +0000 (20:31 +0200)]
summary: list the available static deltas

Write the information in the additional_metadata element for backward
compatibility.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotrivial-httpd: add option to specify the port
Giuseppe Scrivano [Thu, 7 May 2015 09:13:43 +0000 (11:13 +0200)]
trivial-httpd: add option to specify the port

I use the trivial httpd server locally. Each time I restart the
server, I end up modifying manually the config file for other repos so
to point to the correct port. In this way I can just re-use the same
port.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotrivial-httpd: fix indentation
Giuseppe Scrivano [Thu, 7 May 2015 09:09:17 +0000 (11:09 +0200)]
trivial-httpd: fix indentation

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoRemove unnecessary #include "libgsystem.h"
Matthew Barnes [Tue, 5 May 2015 16:14:39 +0000 (12:14 -0400)]
Remove unnecessary #include "libgsystem.h"

10 years agoUse g_auto(GStrv) instead of gs_strfreev
Matthew Barnes [Tue, 5 May 2015 16:13:09 +0000 (12:13 -0400)]
Use g_auto(GStrv) instead of gs_strfreev

10 years agoUse g_autoptr(GVariantBuilder) instead of gs_unref_variant_builder
Matthew Barnes [Tue, 5 May 2015 15:48:15 +0000 (11:48 -0400)]
Use g_autoptr(GVariantBuilder) instead of gs_unref_variant_builder

10 years agoUse g_autoptr(GKeyFile) instead of gs_unref_keyfile
Matthew Barnes [Tue, 5 May 2015 15:47:07 +0000 (11:47 -0400)]
Use g_autoptr(GKeyFile) instead of gs_unref_keyfile

10 years agoUse g_autoptr(GVariant) instead of gs_unref_variant
Matthew Barnes [Tue, 5 May 2015 15:45:46 +0000 (11:45 -0400)]
Use g_autoptr(GVariant) instead of gs_unref_variant

10 years agoUse g_autoptr(GPtrArray) instead of gs_unref_ptrarray
Matthew Barnes [Tue, 5 May 2015 15:44:40 +0000 (11:44 -0400)]
Use g_autoptr(GPtrArray) instead of gs_unref_ptrarray

10 years agoUse g_autoptr(GHashTable) instead of gs_unref_hashtable
Matthew Barnes [Tue, 5 May 2015 15:43:31 +0000 (11:43 -0400)]
Use g_autoptr(GHashTable) instead of gs_unref_hashtable

10 years agoUse g_autoptr(GBytes) instead of gs_unref_bytes
Matthew Barnes [Tue, 5 May 2015 15:41:50 +0000 (11:41 -0400)]
Use g_autoptr(GBytes) instead of gs_unref_bytes

10 years agoUse g_autoptr(GChecksum) instead of gs_free_checksum
Matthew Barnes [Tue, 5 May 2015 15:38:16 +0000 (11:38 -0400)]
Use g_autoptr(GChecksum) instead of gs_free_checksum

10 years agoUse glnx_unref_object instead of gs_unref_object
Matthew Barnes [Tue, 5 May 2015 14:33:53 +0000 (10:33 -0400)]
Use glnx_unref_object instead of gs_unref_object

For non-GIO object types, at least until autocleanup support for GObject
based types becomes more widespread.

10 years agoUse g_autoptr() for GIO object types
Matthew Barnes [Mon, 4 May 2015 22:22:39 +0000 (18:22 -0400)]
Use g_autoptr() for GIO object types

GLib 2.44 supplies all the necessary autocleanup macros for GIO types,
and libglnx backports the relevant macros for ostree.

10 years agoUse g_autofree instead of gs_free
Matthew Barnes [Mon, 4 May 2015 21:58:26 +0000 (17:58 -0400)]
Use g_autofree instead of gs_free

10 years agoJuggling libglnx.h includes
Matthew Barnes [Mon, 4 May 2015 22:08:49 +0000 (18:08 -0400)]
Juggling libglnx.h includes

10 years agogpg: Add ostree_gpg_verify_result_describe_variant()
Matthew Barnes [Tue, 5 May 2015 21:41:13 +0000 (17:41 -0400)]
gpg: Add ostree_gpg_verify_result_describe_variant()

Needed for printing signature details in places where
OstreeGpgVerifyResult cannot go.

10 years agorepo: Stop creating "transaction" symlink
Colin Walters [Mon, 4 May 2015 16:46:32 +0000 (12:46 -0400)]
repo: Stop creating "transaction" symlink

This originally was a way that we detected the case where a pull was
interrupted.  Later, we added `.commitpartial` files which also cover
this case.

See also https://github.com/GNOME/ostree/pull/85

We still want to honor their existence (and unlink them) in case an
old version of ostree was in use, but I believe it's safe to stop
creating them now.

The only case where this would break is if you have a version of
ostree that predates commitpartial in your rollback history, but such
old versions are no longer in use by operating systems I support at
least.

Closes: https://github.com/GNOME/ostree/pull/100
10 years agolibglnx: Pick up bugfix and backports
Matthew Barnes [Wed, 6 May 2015 14:28:31 +0000 (10:28 -0400)]
libglnx: Pick up bugfix and backports

Need more autocleanup backports for GIO types.

10 years agoTeach fsck about partial commits
Colin Walters [Mon, 6 Apr 2015 18:19:08 +0000 (14:19 -0400)]
Teach fsck about partial commits

An OSTree user noticed that `ostree fsck` would produce `missing
object` errors in the case of interrupted pulls.

It's possible to do e.g. `ostree pull --subpath=/usr/share/rpm ...`,
which gets you just that portion of the commit.  The use case for this
was being able to see what changes would appear in an update before
actually downloading all of it.

(I think this would be better covered by static deltas, but those
 aren't final yet, and `--subpath` predates it)

Further, `.commitpartial` is used as a successor to the `transaction`
symlink for more precise knowledge in the case where a pull was
interrupted that we needed to resume scanning.

So it makes sense for `ostree fsck` to be aware of it.

10 years agocore: Cleanup commitpartial file with fd-relative lookups
Colin Walters [Sun, 5 Apr 2015 18:07:03 +0000 (14:07 -0400)]
core: Cleanup commitpartial file with fd-relative lookups

First, this is just a general continuation of the `GFile -> openat`
transition.

Second, it's preparatory work for fsck to gain awareness of partial
commits.

10 years agodoc: remove unknown parameter from inline documentation
Giuseppe Scrivano [Tue, 5 May 2015 14:28:11 +0000 (16:28 +0200)]
doc: remove unknown parameter from inline documentation

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: Fix an obvious typo
Matthew Barnes [Tue, 5 May 2015 14:24:38 +0000 (10:24 -0400)]
repo: Fix an obvious typo

10 years agolibglnx: fix reference to commit
Giuseppe Scrivano [Tue, 5 May 2015 14:20:18 +0000 (16:20 +0200)]
libglnx: fix reference to commit

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agosysroot: Add an API to lock
Colin Walters [Mon, 4 May 2015 22:35:52 +0000 (18:35 -0400)]
sysroot: Add an API to lock

If a system administrator happens to type `ostree admin upgrade`
multiple times, currently that will lead to a potentially corrupted
system.

I originally attempted to do locking *internally* in `libostree`, but
that didn't work out because currently a number of the commands
perform multi-step operations that all need to be serialized.  All of
the current code in `ostree admin deploy` is an example.

Therefore, allow callers to perform locking, as most of the higher
level logic is presently implemented there.

At some point, we can revisit having internal locking, but it will be
difficult.  A more likely approach would be similar to Java's approach
with concurrency on iterators - a "fail fast" method.

10 years agoFix build when using GLib < 2.44
Matthew Barnes [Mon, 4 May 2015 16:00:54 +0000 (12:00 -0400)]
Fix build when using GLib < 2.44

10 years agopull: the commit size in the summary is not for the detached metadata
Giuseppe Scrivano [Tue, 28 Apr 2015 09:56:53 +0000 (11:56 +0200)]
pull: the commit size in the summary is not for the detached metadata

Use the size specified in the summary file only for the not detached
metadata.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agogpg: Fix _ostree_gpg_verifier_add_keyring()
Matthew Barnes [Fri, 1 May 2015 19:19:20 +0000 (15:19 -0400)]
gpg: Fix _ostree_gpg_verifier_add_keyring()

The function never fails, but its API makes it look like it can.

Fortunately it's private, so just fix it.

10 years agoostree: Split up "remote" subcommands
Matthew Barnes [Wed, 29 Apr 2015 15:09:40 +0000 (11:09 -0400)]
ostree: Split up "remote" subcommands

To make room for "remote gpg-import", which will be non-trivial.
ot-builtin-remote.c was already a little too crowded anyway.

Also while we're at it, port this bit of code away from libgsystem.

10 years agorepo: Initialize GPGME in instance init()
Matthew Barnes [Thu, 30 Apr 2015 15:06:24 +0000 (11:06 -0400)]
repo: Initialize GPGME in instance init()

Initially I had this in class_init() but there it would get invoked
during introspection scanning.

10 years agolibotutil: Add ot_gpgme_ctx_tmp_home_dir()
Matthew Barnes [Mon, 27 Apr 2015 01:25:35 +0000 (21:25 -0400)]
libotutil: Add ot_gpgme_ctx_tmp_home_dir()

Currently used for signature verification, will also be used for
importing GPG keys.

10 years agolibotutil: Establish a place for GPG utilities
Matthew Barnes [Sun, 26 Apr 2015 22:08:20 +0000 (18:08 -0400)]
libotutil: Establish a place for GPG utilities

Add ot-gpg-utils.[ch] and move _ostree_gpg_error_to_gio_error() here.

10 years agoshow: add option --gpg-homedir
Giuseppe Scrivano [Mon, 27 Apr 2015 09:15:40 +0000 (11:15 +0200)]
show: add option --gpg-homedir

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agogpg: do not use secring.gpg
Giuseppe Scrivano [Mon, 27 Apr 2015 08:59:34 +0000 (10:59 +0200)]
gpg: do not use secring.gpg

It contains the secret keyring

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agog_output_stream_splice: check correctly the error code
Giuseppe Scrivano [Fri, 24 Apr 2015 10:37:49 +0000 (12:37 +0200)]
g_output_stream_splice: check correctly the error code

While at it, change the style of other two occurrences.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotest-auto-summary.sh properly quote arguments to assert_streq
Giuseppe Scrivano [Fri, 24 Apr 2015 13:42:28 +0000 (15:42 +0200)]
test-auto-summary.sh properly quote arguments to assert_streq

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: Always request detached metadata for commits
Matthew Barnes [Tue, 21 Apr 2015 20:20:28 +0000 (16:20 -0400)]
pull: Always request detached metadata for commits

Always request detached metadata for commit objects, even if we already
have the commit object.  This ensures we fetch any post facto detached
metadata updates such as new GPG signatures.

https://bugzilla.gnome.org/748220

10 years agoreset: update help output
Micah Abbott [Thu, 23 Apr 2015 18:11:33 +0000 (14:11 -0400)]
reset: update help output

The inline help for 'ostree reset' now correctly shows that it
requires a REF and a COMMIT as arguments.

10 years agoREADME.md: fix typo
Giuseppe Scrivano [Tue, 21 Apr 2015 21:04:28 +0000 (23:04 +0200)]
README.md: fix typo

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agodeploy: Drop a fsync, use fd-relative APIs
Colin Walters [Mon, 20 Apr 2015 15:41:54 +0000 (11:41 -0400)]
deploy: Drop a fsync, use fd-relative APIs

Now that we can rely on `syncfs()`, drop another fsync in the deploy
path.  While we're here, convert it to fd-relative.

10 years agodeploy: Drop fsync of modified config files
Colin Walters [Sun, 19 Apr 2015 16:34:01 +0000 (12:34 -0400)]
deploy: Drop fsync of modified config files

These fsyncs were added for what turned out to be a fairly bogus
reason; I was hitting read errors from extlinux after upgrades and out
of conservatisim tried adding fsync calls, but the *actual* problem
was that extlinux didn't support 64 bit ext4.  Now that at least for
Project Atomic hosts we're just targeting grub2, we can drop these
fsync calls and rely on `syncfs()` being both faster and catching any
errors.

10 years agodeploy: Use syncfs() in addition to sync()
Colin Walters [Tue, 14 Apr 2015 17:47:08 +0000 (13:47 -0400)]
deploy: Use syncfs() in addition to sync()

For some sort of crazy reason, the `sync()` system call doesn't
actually return an error code, even though from what I can tell in the
kernel it wouldn't be terribly hard to add.

Regardless though, it is better for userspace apps to use `syncfs()`
to avoid flushing filesystems unrelated to what they want to sync.  In
the case of OSTree, this does matter - for example you might have a
network mount point backing your database, and we don't want to block
upgrades on syncing it.

This change is safe because we're doing syncfs in *addition* to the
previous global `sync()` (a revision from an earlier patch).

Now because OSTree only touches the `/` mount point which covers the
repository, the deployment roots (including their copy of `/etc`), as
well as `/boot`, we should at some point later be able to drop the
`sync()` call.  Note that on initial system installs we do relabel
`/var` but that shouldn't happen at ostree time - any new directories
are taken care of via `systemd-tmpfiles` on boot.

10 years agostatus: Don't crash if we deployed a local refspec
Colin Walters [Tue, 21 Apr 2015 01:02:25 +0000 (21:02 -0400)]
status: Don't crash if we deployed a local refspec

In the case we built a local tree, we'd pass `NULL` as a remote down
to the GPG checking code.  Noticed this in the test suite.

10 years agosysroot: Close sysroot fd in finalize
Colin Walters [Sun, 19 Apr 2015 19:25:05 +0000 (15:25 -0400)]
sysroot: Close sysroot fd in finalize

Just noticed this while I was going to add another one there.

10 years agolibglnx: Update from master
Colin Walters [Fri, 17 Apr 2015 20:15:55 +0000 (16:15 -0400)]
libglnx: Update from master

No real changes, but I'd like to use some of the new APIs later.

10 years agoRelease 2015.6
Colin Walters [Fri, 17 Apr 2015 18:16:08 +0000 (14:16 -0400)]
Release 2015.6

10 years agosysroot: Add ostree_sysroot_get_fd()
Colin Walters [Fri, 17 Apr 2015 13:13:31 +0000 (09:13 -0400)]
sysroot: Add ostree_sysroot_get_fd()

This way external programs like rpm-ostree can do fd-relative
operations on the deployment directories, like inspecting the RPM
database.

Closes: https://github.com/GNOME/ostree/pull/91